const tool = require("../util/tool");
module.exports = async (ctx, next) => {
    try {
        await next()
    } catch (err) {
        let statusCode = err.statusCode || err.status;
        ctx.app.emit('error', err, ctx);
        if (statusCode === 404 || ctx.status === 404) {
            await tool.renderError(ctx);
        }
        else {
            console.info(err);
        }
    }
}
